feat(ldraw): add Fabric material variant#66
Open
bkfunk wants to merge 2 commits into
Open
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class support for LDraw’s FABRIC color material by introducing a new Material::Fabric variant and recognizing the FABRIC keyword during LDConfig.ldr color-definition parsing.
Changes:
- Added
Fabricto theMaterialenum. - Updated
parse_color_definitionsto map theFABRICkeyword toMaterial::Fabric.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
ldraw/src/color.rs |
Extends the public Material enum with a Fabric variant to represent the LDraw FABRIC material. |
ldraw/src/parser.rs |
Recognizes FABRIC in !COLOUR definitions and assigns Material::Fabric during parsing. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Two follow-ups from review on segfault87#66: - Mark `Material` as `#[non_exhaustive]`. The enum has accumulated variants over time (Glow, Metal, MatteMetallic, now Fabric); flagging it `non_exhaustive` lets future additions avoid the same downstream breakage this PR causes for exhaustive `match`-ers. - Extend `test_parse_color_definition` with a FABRIC color (code 10) so the new top-level `FABRIC` parse branch in `parse_color_definitions` is exercised. (The existing `parse_customized_material` FABRIC arm, introduced by the rust-2024 commit, handles `MATERIAL FABRIC CANVAS` and is on a separate code path.) Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
Material::Fabricand parses theFABRICmaterial keyword inLDConfig.ldr. LDraw's color spec supports aFABRICmaterial (used for capes, flags, and other soft-goods items); without this variant, color definitions that declareFABRICfall back to default-material handling and lose their material classification.Change
ldraw/src/color.rs: addFabricvariant toMaterialldraw/src/parser.rs: recognize theFABRICkeyword inparse_color_definitionsand assignMaterial::FabricTest plan
cargo check -p ldrawpassesLDConfig.ldrthat contains aFABRIC-material color and confirm the resultingMaterial::Fabric